// page/member/complaint.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    name:'',
    textat:''
  },
  name:function(e){
    this.setData({
      name: e.detail.value
    })
    console.log(e.detail.value)
  },
  textat:function(e){
    this.setData({
      textat: e.detail.value
    })
    console.log(e.detail.value)
  },
  count: function () {
    var app = getApp()
    var that = this;
    var uid = wx.getStorageSync('uid');
    var name = this.data.name;
    // var nameleng = this.data.name.length;
    var textat = that.data.textat
    // var textlength = that.data.textat.length;
    if (name.length < 1 || textat.length<1){
      wx.showModal({
        title: '提示',
        content: '请填写要投诉的教练及原因',
        showCancel: false,
        // mask:true,
        duration: 2000,
      })
    }else{
      wx.request({
        url: app.globalData.host + '&g=App&m=User&a=online_complaint',
        data: {
          uid: uid,
          name: that.data.name,
          message: that.data.textat
        },
        header: {
          'content-type': 'application/json'
        },
        success: function (res) {

          that.setData({
          })
        }
      })
      wx.showModal({
        title: '提示',
        content: '提交成功',
        showCancel: false,
        mask: true,
        success: function (res){
          if (res.confirm) {
            wx.navigateBack({
              url: 'member'
            })
          }
        }
      })
    }
    // console.log(uid)
  }
})